package com.aatattoo.light_food_service.service;

import com.aatattoo.light_food_service.entity.UserFollow;
import com.aatattoo.light_food_service.mapper.UserFollowMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Component
public class UserFollowService {
    @Autowired
    private UserFollowMapper userFollowMapper;

    /**
     * 统计关注数量（用户ID）
     * @param userId
     * @return
     */
    public int countFollowById(int userId){
        return userFollowMapper.countFollowById(userId);
    }

    /**
     * 统计粉丝数量（用户Id）
     * @param userId
     * @return
     */
    public int countFansById(int userId){
        return userFollowMapper.countFansById(userId);
    }

    public int addfollow(UserFollow userFollow){
        return userFollowMapper.addfollow(userFollow);
    }

    public int deletefollow(UserFollow userFollow){
        return userFollowMapper.deletefollow(userFollow);
    }

    public List<UserFollow> followFindById(int userId){
        return userFollowMapper.followFindById(userId);
    }

    public List<UserFollow> fansFindById(int userId){
        return userFollowMapper.fansFindById(userId);
    }
    public int mutualAttentionFindById(UserFollow userFollow){
       return userFollowMapper.mutualAttentionFindById(userFollow);
    }

    public int findFollowByBothId(UserFollow userFollow){
        return userFollowMapper.findFollowByBothId(userFollow);
    }

    public int countRemind(int userId){
        return userFollowMapper.countRemind(userId);
    }

    public int updateRemind(@Param("userId")int userId){
        return userFollowMapper.updateRemind(userId);
    }
}
